<template>
  <el-drawer
    :title="$t('message.ddxq')"
    :visible.sync="showOrder"
    size="1000px"
    :wrapper-closable="!modalDialog"
  >
    <div class="property-title">{{ $t('message.ddxq') }}</div>
    <div class="df_ac">
      <div>
        <span class="key">{{ $t('message.ddbh') }}：</span>
        <span class="value">{{ detail.orderId }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.ddzt') }}：</span>
        <span class="value">{{ detail.orderStatus }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.createTime') }}：</span>
        <span class="value">{{ detail.orderTime }}</span>
      </div>
      <div v-if="detail.payTime">
        <span class="key">{{ $t('message.paytime') }}：</span>
        <span class="value">{{ detail.payTime }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.ddly') }}：</span>
        <span class="value">{{ detail.fromType == '01'?$t('message.xcx'): $t('message.cgpcd') }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.ddje') }}：</span>
        <span class="value">{{ detail.orderPrice }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.zffs') }}：</span>
        <span class="value">{{ detail.payMethod || '-' }}</span>
      </div>
      <div v-if="detail.mixedPayMethod">
        <span class="key">{{ $t('message.hhzffs') }}：</span>
        <span class="value">{{ detail.mixedPayMethod || '-' }}</span>
      </div>
      <div v-if="detail.mixedPayMoney">
        <span class="key">{{ $t('message.hhzfje') }}：</span>
        <span class="value">{{ detail.mixedPayMoney || '-' }}</span>
      </div>
      <div v-if="detail.cardPayMoney">
        <span class="key">{{ $t('message.hhzfhykje') }}：</span>
        <span class="value">{{ detail.cardPayMoney || '-' }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.czy') }}：</span>
        <span class="value">{{ detail.createUser }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.bz') }}：</span>
        <span class="value">{{ detail.remake }}</span>
      </div>
    </div>

    <div class="line-style mb20" />
    <div class="property-title">{{ $t('message.kpqk') }}</div>
    <div class="df_ac">
      <div>
        <span class="key">{{ $t('message.kpzt') }}：</span>
        <span class="value">{{ detail.invoiceStatus }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.kpzt') }}：</span>
        <span class="value">{{ detail.invoiceTime || "~" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">{{ $t('message.mjxx') }}</div>
    <div class="df_ac mt20">
      <div>
        <span class="key">{{ $t('message.name') }}：</span>
        <span class="value">{{ detail.memberName }}</span>
      </div>
      <div>
        <span class="key">{{ $t('message.lxdh') }}：</span>
        <span class="value">{{ detail.memberPhone }}</span>
      </div>
      <div v-if="detail.memberId">
        <span class="key">{{ $t('message.hykh') }}：</span>
        <span class="value">{{ detail.memberId }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">{{ $t('message.bmryxx') }}</div>

    <el-table
      v-loading="listLoading"
      :data="detail.orderDetailList"
      element-loading-text="Loading"
      border
      fit
      :header-row-class-name="'table-header'"
      class="doumee-element-table"
    >
      <el-table-column
        align="center"
        :label="$t('message.name')"
        prop="name"
        min-width="120"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="$t('message.sex')"
        prop="sex"
        min-width="80"
        show-overflow-tooltip
      >
        <template v-slot="scope">
          <span v-if="scope.row.sex == '1'">{{ $t('message.nan') }}</span>
          <span v-else-if="scope.row.sex == '2'">{{ $t('message.nv') }}</span>
          <span v-else>-</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        :label="$t('message.csrq')"
        prop="birthday"
        min-width="120"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="$t('message.sfzh')"
        prop="cardNo"
        min-width="140"
        show-overflow-tooltip
      />
    </el-table>

    <div v-if="detail.detailMoneyRespParam" class="bottom_wrap">
      <div v-if="detail.detailMoneyRespParam.orderPrice" class="line">
        <span>{{ $t('message.ddspje') }}：</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.orderPrice || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.memberDiscount" class="line">
        <span>{{ $t('message.hydk') }}：</span>
        <span v-if="detail.detailMoneyRespParam.memberDiscount">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.memberDiscount || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.marketingPolicy" class="line">
        <span>{{ $t('message.yxzc') }}：</span>
        <span v-if="detail.detailMoneyRespParam.marketingPolicy">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.marketingPolicy || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.groupBuyCoupon" class="line">
        <span>{{ $t('message.tgj') }}：</span>
        <span v-if="detail.detailMoneyRespParam.groupBuyCoupon">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.groupBuyCoupon || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.discountCoupon" class="line">
        <span>{{ $t('message.yhj') }}：</span>
        <span v-if="detail.detailMoneyRespParam.discountCoupon">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.discountCoupon || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.integral" class="line">
        <span>{{ $t('message.jfdk') }}：</span>
        <span v-if="detail.detailMoneyRespParam.integral">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.integral || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.getPrice || detail.detailMoneyRespParam.getPrice === 0" class="line secondColor">
        <span>{{ $t('message.shk') }}：</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.getPrice || 0 }}</span>
        <span>{{ $t('message.yuan') }}</span>
      </div>
    </div>
  </el-drawer>
  <!--</div> -->
</template>

<script>
import { applyOrderDetail } from '@/api'
import store from '@/store'
export default {
  name: 'OrderDetail',
  data() {
    return {
      detail: {},
      modalDialog: store.getters.dialog,
      showOrder: false, // 弹窗
      listLoading: false
    }
  },
  methods: {
    goBack() {
      this.$router.replace('/ticket/ticketOrder')
    },
    getTicketOrderDetail(orderId) {
      this.listLoading = true
      applyOrderDetail({ param: { activityOrderId: orderId }}).then((res) => {
        this.listLoading = false
        if (res.errorCode === '000000') {
          this.showOrder = true
          this.detail = res.record
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>

.df_ac {
  flex-wrap: wrap;
  div {
    width: 33.33%;
    margin-bottom: 20px;
    .key {
  color: #666666;
  display: inline-block;
  // width: 90px;
  // text-align: right;
}
.value {
  color: #222;
}
  }
}
.bottom_wrap {
  margin-top: 30px;
  text-align: right;
  .line {
    margin-bottom: 10px;
  }
}
</style>
